package com.wayne.util;

import com.wayne.exceptions.CheckException;

import java.util.stream.Stream;

/**
 * 校验工具类
 */
public class CheckUtil {
    public static final String[] INVALID_NAMES = {"admin", "管理员"};

    /**
     * 名称校验
     *
     * @param value
     */
    public static void checkName(String value) {
        Stream.of(INVALID_NAMES).filter(name -> name.equalsIgnoreCase(value)).findAny().ifPresent(name -> {
            throw new CheckException("name", value);
        });
    }
}
